/**
 * @copyright liuzhenhao
 * @description 连接websocket 获取实时状态返回信息
 */

const state = {
  infoList: [],
  ysxAreaList:[],
  ysxSceneList: [],
  ysxLightList: [],
  noticeshow: false,
  webSocketMsg: ""
};
const getters = {
  infoList: (state) => state.infoList,
  ysxAreaList: (state) => state.ysxAreaList,
  ysxSceneList: (state) => state.ysxSceneList,
  ysxLightList: (state) => state.ysxLightList,
  noticeshow: (state) => state.noticeshow,
};
const mutations = {
  SET_WS_MSG(state, msg){
      state.webSocketMsg = msg
  },
  setNoticeshow(state, noticeshow) {
    state.noticeshow = noticeshow;
  },
  setInfoList(state, infoList) {
    state.infoList.push(infoList);
  },
  setYsxAreaList(state, ysxAreaList) {
    state.ysxAreaList = ysxAreaList;
  },
  setYsxSceneList(state, ysxSceneList) {
    state.ysxSceneList = ysxSceneList;
  },
  setYsxLightList(state, ysxLightList) {
    state.ysxLightList = ysxLightList;
  }
};
const actions = {
  setNoticeshow({ commit }, noticeshow) {
    commit("setNoticeshow", noticeshow);
  },
  setInfoList({ commit }, infoList) {
    commit("setInfoList", infoList);
  },
  setYsxAreaList({ commit }, ysxAreaList) {
    commit("setYsxAreaList", ysxAreaList);
  },
  setYsxSceneList({ commit }, ysxSceneList) {
    commit("setYsxSceneList", ysxSceneList);
  },
  setYsxLightList({ commit }, ysxLightList) {
    commit("setYsxLightList", ysxLightList);
  }
};
export default { state, getters, mutations, actions };
